home *** CD-ROM | disk | FTP | other *** search
- /* ErrorAlert.c */
- /*
- * DTS AddressOMatic Sample
- * ErrorAlert.c
- * Copyright © 1993 Apple Computer Inc. All rights reserved.
- *
- * Display an error message.
- */
-
- #include "AddressOMaticTest.h"
-
- void
- ErrorAlert(
- short alrtResId,
- OSErr errorValue,
- ConstStr255Param errorText
- )
- {
- Str15 errorValueText;
- Str255 macErrorText;
- Handle macErrorHdl;
-
- NumToString(errorValue, errorValueText);
- macErrorHdl = GetResource('Estr', errorValue);
- if (macErrorHdl == NULL)
- macErrorText[0] = 0;
- else {
- pstrcpy(macErrorText, (StringPtr) *macErrorHdl);
- ReleaseResource(macErrorHdl);
- }
- PositionDialog('ALRT', alrtResId);
- ParamText(
- errorValueText,
- macErrorText,
- (errorText == NULL) ? "\p" : errorText,
- "\p"
- );
- InitCursor();
- if (Alert(alrtResId, NULL) == cancel) {
- /*
- * When we have open files, this might
- * be changed to let the user have a last
- * chance to save files. On the other hand,
- * only the "Fatal Error" alert has a
- * cancel button.
- */
- ExitToShell();
- }
- }
-